package com.tmc.web.controller.intair;

import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.tmc.bean.common.ContextInfo;
import com.tmc.bean.common.TripartiteReport;
import com.tmc.service.intair.IntairFairServiceImpl;
import com.tmc.util.ObjectUtil;
import com.tmc.web.BaseController;

@Controller
@RequestMapping(value="/tripartitereport")
public class TripartiteReportController extends BaseController {
	
	@Autowired
	private IntairFairServiceImpl faceService;
	
	@RequestMapping(value="/tripartite",method=RequestMethod.GET)
	public ModelAndView tripartite(TripartiteReport cond, HttpServletRequest request){
		ContextInfo context = this.getContextInfo(request);
		if(!ObjectUtil.hasText(cond.getDateCondition())){
			cond.setDateCondition("operatoringTime");
		}
		Map<String, Object> reportsMap = faceService.findByCond(context, cond);
		
		Map<String,Object> map= new HashMap<String,Object>();
		map.put("cond", cond);
		map.put("reportsMap", reportsMap);
		map.put("context", context);
		return new ModelAndView("views/report/tripartite-report", map);	
	}
}
